// 云函数入口文件
const cloud = require('wx-server-sdk')

cloud.init()

// 云函数入口函数
exports.main = async (event, context) => {
  const wxContext = cloud.getWXContext()
  try {
    const db = cloud.database()
    //这里的update依据是event._id
    return await db.collection("product").doc(event._id).update({
      
      data: {
        _count: event._count,
      }
    })
  } catch (e) {
    console.error(e)
  }
}